package io.sunny.platform.mcp.domain.model;

import jakarta.persistence.*;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.PastOrPresent;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;

/**
 * @Author SUNNY
 * @Date 2025/12/3 17:27
 * @PackageName: io.sunny.platform.agent.mcp.domain.model
 * @Description: TODO
 * @Version 1.0
 */
@Entity
@Table(name = "books")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Book implements Serializable {
    @Serial
    private static final long serialVersionUID = -3004624289691589697L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @NotBlank(message = "书名不能为空")
    @Column(nullable = false)
    private String title;
    @NotBlank(message = "分类不能为空")
    @Column(nullable = false)
    private String category;
    @NotBlank(message = "作者不能为空")
    @Column(nullable = false)
    private String author;
    @NotBlank(message = "出版日期不能为空")
    @PastOrPresent(message = "出版日期不能是未来日期")
    @Column(nullable = false)
    private LocalDate publicationDate;
    @NotBlank(message = "ISBN编码不能为空")
    @Column(nullable = false, unique = true)
    private String isbn;
}
